/// @tags:
#include <cstdio>
#include <functional>
#include <iostream>
#include <numeric>

using std::cin, std::cout, std::endl;

namespace BlueQuantum {

constexpr int maxn = 100;

int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    if (n & 1) {
      if (n == 3)
        cout << "NO\n";
      else {
        cout << "YES\n";
        for (int i = 1; i < n; i += 2) {
          cout << n - 3 << ' ' << 1 - n << ' ';
        }
        cout << n - 3 << '\n';
      }
    } else {
      cout << "YES\n";
      for (int i = 1; i <= n; i += 2) {
        cout << 1 << ' ' << -1 << ' ';
      }
      cout << '\n';
    }
  }
  return 0;
}

}  // namespace BlueQuantum

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("B. MKnez's ConstructiveForces Task.in", "r", stdin);
  freopen("B. MKnez's ConstructiveForces Task.out", "w", stdout);
#endif
#endif

  std::ios::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  return BlueQuantum::main();
}
